<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>会员</title>
	<script th:src="@{/layui/layui.js}" type="text/javascript"></script>
	<link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
	</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
	<legend>新增</legend>
</fieldset>
<div style="margin: 20px">
<form class="layui-form" action="">
	<div class="layui-form-item">
		<label class="layui-form-label">用户名</label>
		<div class="layui-input-block">
			<input type="text" name="lName"   autocomplete="off" lay-verify="required" class="layui-input" placeholder="输入用户名"/>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">用户昵称</label>
		<div class="layui-input-block">
			<input type="text" name="lPname"   autocomplete="off" lay-verify="required" class="layui-input" placeholder="输入用户昵称" />
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">用户密码</label>
		<div class="layui-input-block">
			<input type="password" name="lPassword"  lay-verify="required" autocomplete="off" class="layui-input" placeholder="输入密码"/>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">用户手机</label>
		<div class="layui-input-block">
			<input type="text" name="lPhone"  autocomplete="off" lay-verify="required" class="layui-input"placeholder="输入手机号" />
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">用户性别</label>
		<div class="layui-input-block">
			<select name="lSex" lay-verify="lSex" lay-search="">
				<option value="1" >男</option>
				<option value="2" >女</option>
			</select>
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">用户等级</label>
		<div class="layui-input-block">
			<select name="cGrade" lay-verify="cGrade" lay-search="">
				<option value="0" >普通用户</option>
				<option value="1" >VIP用户</option>
				<option value="2" >高级VIP用户</option>
			</select>
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">用户状态</label>
		<div class="layui-input-block">
			<select name="cType" lay-verify="cType" lay-search="">
				<option value="0" >禁用</option>
				<option value="1" >可用</option>
				<option value="2" >注销</option>
			</select>
		</div>
	</div>
	<div class="layui-form-item" style="display: none">
		<div class="layui-input-block">
			<a class="layui-btn" lay-submit="" lay-filter="submitBtn" id="submitBtn"></a>
		</div>
	</div>

</form>
</div>
</body>
<script>
	var $;
	layui.use(['form','jquery','upload','element','layer'],function () {
		var form = layui.form,
				upload = layui.upload,
				layer = layui.layer,
				elem = layui.element;
		$ = layui.jquery;

		/*//头像上传
		var photoUpload = upload.render({
			elem:'#checkPhoto',
			url:'/file/fc/fileUpload',
			before: function (obj) {
				obj.preview(function (i,f,r) {
					$('#photo').attr('src',r);
				});
				elem.progress('photoProgress','0%');
			},
			done:function (res) {
				if(!res.is){
					layer.alert('上传失败，请稍后再试......')
				}else{
					$('#photoPath').val(res.file.id);
				}
			},
			error:function(){

			},
			progress:function (n,el,e) {
				elem.progress('photoProgress',n+'%');
				if(n==100){
					layer.msg('上传完成!',{icon:1});
				}
			}
		})*/

		form.on('submit(submitBtn)',function (data) {
			var formData = data.field;
			$.ajax({
				type:'post',
				url:'/system/mcs/add',
				data:formData,
				dataType:'json',
				success:function (result) {
					layer.msg(result.msg);
					if(result.is){
						let index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);//关闭父页面窗口
					}
				}
			})
		})

	})

	function btnSubmit() {
		$('#submitBtn').click();
	}
</script>

</html>
